﻿/*=============================================================================
	TASK 3:                                                            {Loop's}
	Write a program that reads from the console a sequence of N integer numbers
    and returns the minimal and maximal of them.  
=============================================================================*/

using System;

class MinAndMaxOfSequenceOfNIntegers
{
    static void Main()
    {
        int newNumber, max, min;

        Console.Write("How many numbers will you compare?:");
        int countNumbers = int.Parse(Console.ReadLine());

        Console.Write("n1=");
        newNumber = int.Parse(Console.ReadLine());
        
        min=max = newNumber;

        for (int i = 1; i < countNumbers; i++)
        {
            Console.Write("n{0}=", i + 2);
            newNumber = int.Parse(Console.ReadLine());
            
            if (newNumber > max)
	        {
		        max=newNumber;
	        }
            
            else if(newNumber<min) 
            {
                min = newNumber;
            }
        }

        Console.WriteLine("\nmin={0}\nmax={1}", min, max);

    }
}

